package com.uqbar.asteroids.game;

import java.awt.Color;
import java.awt.Dimension;

import com.uqbar.asteroids.components.Marcador;
import com.uqbar.asteroids.components.Player;
import com.uqbar.asteroids.components.RedBoom;
import com.uqbar.asteroids.endscene.EndScene;
import com.uqbar.asteroids.scenes.AsteroidScene;
import com.uqbar.vainilla.DesktopGameLauncher;
import com.uqbar.vainilla.Game;

public class AsteroidsGame extends Game{

	@Override
	protected void initializeResources() {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void setUpScenes() {
		AsteroidScene scene = this.buildAsteroidScene();
		this.setCurrentScene(scene);
	}

	public AsteroidScene buildAsteroidScene() {
		AsteroidScene scene = new AsteroidScene(new RedBoom(),"/AsteroidShip.png");
		
		scene.agregarAsteroides(10);
		scene.setMarcador(new Marcador(0,0,Color.WHITE));
		scene.setJugador(new Player(getDisplayWidth(), getDisplayHeight(), scene.getShipselected()));
		scene.getShipselected().setX(getDisplayWidth()/2);
		scene.getShipselected().setY(getDisplayHeight()/2);

 
		return scene;
	}
	
	public AsteroidScene buildAsteroidSceneWithMarker(Marcador marcador){
		AsteroidScene scene = new AsteroidScene(new RedBoom(),"/AsteroidShip.png");
		scene.sustituirMarcadorPorMarcador(marcador);
		scene.agregarAsteroides(10);
		scene.setJugador(new Player(getDisplayWidth(), getDisplayHeight(), scene.getShipselected()));
		scene.getShipselected().setX(getDisplayWidth()/2);
		scene.getShipselected().setY(getDisplayHeight()/2);

		return scene;
	}

	public EndScene buildEndScene(Marcador marcador){
		return new EndScene(marcador, this.getDisplayWidth() / 6,
				this.getDisplayHeight() / 10);
	}
	
	
	@Override
	public Dimension getDisplaySize() {
		return new Dimension(800,600);
	}

	@Override
	public String getTitle() {
		return "Asteroids";
	}
	
	public static void main(String[] args) throws Exception {
		new DesktopGameLauncher(new AsteroidsGame()).launch();
	}

}
